package cn.lzy.RabbitMQ.config;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

/**
 * @Author: WeiKaiYe
 * @CreateTime: 2023-10-19  16:24
 */

/*@Service
public class RabbitMQService {

    *//**
     * 1、定义topic_exchange分发器
     * 2、定义topic_queue_email邮箱消息队列
     * 3、topic_queue_email邮箱消息队列跟topic_exchange分发器绑定
     * 4、接收消息类型的key值是 info.#.email.#
     *//*

    // 通配符模式消息接收、进行qq业务订阅处理  topic_exchange
    @RabbitListener(bindings = @QueueBinding(value = @Queue("topic_queue_qq"),
            exchange = @Exchange(value = "topic_exchange",type = "topic"),key = "info.#.qq.#"))
    public void topicConsumerQq(String message){
        System.out.println("接收qq订阅需求处理消息：  "+message);
    }

    // 通配符模式消息接收、进行微信业务订阅处理
    @RabbitListener(bindings = @QueueBinding(value = @Queue("topic_queue_wechat"),
            exchange = @Exchange(value = "topic_exchange",type = "topic"),key = "info.#.wechat.#"))
    public void topicConsumerWechat(String message){
        System.out.println("接收微信订阅需求处理消息：  "+message);
    }

    // 通配符模式消息接收、进行邮件业务订阅处理
    @RabbitListener(bindings = @QueueBinding(value = @Queue("topic_queue_email"),
            exchange = @Exchange(value = "topic_exchange",type = "topic"),key = "info.#.email.#"))
    public void topicConsumerEmail(String message){
        System.out.println("接收邮件订阅需求处理消息：  "+message);
    }
}*/
